﻿


var JsonSetting; //{UserID:xx,UserName:xx,UserTel:xx}

//显示用户选择器
function showUserPicker(jsonSetting) {
    JsonSetting = jsonSetting;

    var dialog = $("#dialog-userpicker");
    //alert(dialog.length);

    if (dialog.length == 0) {
        var div = document.createElement("div");
        div.id = "dialog-userpicker";
        div.title = "选择用户";

        var frame = document.createElement("iframe");
        frame.className = "frm";
        frame.src = "/Account/UserPicker";
        frame.scrolling = "no";
        frame.marginheight = 0;
        frame.marginwidth = 0;
        frame.height = "98%";
        frame.width = "98%";
        frame.setAttribute("frameborder", "0", 0);

        div.appendChild(frame);

        $("body").append(div);

        $("#dialog-userpicker").dialog({
            autoOpen: false,
            modal: true,
            width: 700,
            height: 550,
            buttons: {}
        });
    }

    $("#dialog-userpicker").dialog("open");
}
//显示用户选择器
function showEmployeePicker(jsonSetting) {

    JsonSetting = jsonSetting;

    var dialog = $("#dialog-userpicker");
    //alert(dialog.length);

    if (dialog.length == 0) {
        var div = document.createElement("div");
        div.id = "dialog-userpicker";
        div.title = "选择用户";

        var frame = document.createElement("iframe");
        frame.className = "frm";
        frame.src = "/Account/UserPickeremployee";
        frame.scrolling = "no";
        frame.marginheight = 0;
        frame.marginwidth = 0;
        frame.height = "98%";
        frame.width = "98%";
        frame.setAttribute("frameborder", "0", 0);

        div.appendChild(frame);

        $("body").append(div);

        $("#dialog-userpicker").dialog({
            autoOpen: false,
            modal: true,
            width: 700,
            height: 550,
            buttons: {}
        });
    }

    $("#dialog-userpicker").dialog("open");
}

function closeUserPicker() {
    $("#dialog-userpicker").dialog("close");
}
//选择用户
function selectedUserPicker(userID, name, tel) {
    if (JsonSetting.UserID != undefined)
        $("#" + JsonSetting.UserID).val(userID);
    if (JsonSetting.UserName != undefined)
        $("#" + JsonSetting.UserName).val(name);
    if (JsonSetting.UserTel != undefined)
        $("#" + JsonSetting.UserTel).val(tel);

    closeUserPicker();
}